<?php 
/**
 * Grafico de Servicio Por Provincia 
 * @author Natanael
 * 
 */

class graficoProvincia extends Controller{
	
	public function __construct()
	{
		parent::controller();
		$this->load->helper('grafico');
	}
	
	public function index()
	{
		
		
		$grafico = renderMap(base_url()."public/swf_charts/MSColumn3DLineDY.swf",$this->data(),"","UsaMaps", 750, 460,0,0);
		$this->load->view('mainReporte',array('content_page'=>$grafico));
	}
	
	public function data()
	{
      $dataArray[0][1]="01"; //Azua
      $dataArray[0][2]="0"; //Population 
      $dataArray[1][1]="02"; //Bahoruco
      $dataArray[1][2]="1"; //Population
      $dataArray[2][1]="03"; //Barahona
      $dataArray[2][2]="2"; //Population
      $dataArray[3][1]="04"; //Dajabon
      $dataArray[3][2]="3"; //Populatio 
      $dataArray[4][1]="05"; //No se save
      $dataArray[4][2]="4"; //Population
      $dataArray[5][1]="06"; //Duarte
      $dataArray[5][2]="5"; //Populatio 
      $dataArray[6][1]="07"; //nose save
      $dataArray[6][2]="0"; //Population
      $dataArray[7][1]="08"; //Espaillat
      $dataArray[7][2]="7"; //Population
      $dataArray[8][1]="09"; //Independencia
      $dataArray[8][2]="8"; //Population
      $dataArray[9][1]="10"; //La Altagracia
      $dataArray[9][2]="9"; //Population 
      $dataArray[10][1]="11"; //Elias Pina
      $dataArray[10][2]="10"; //Population 
      $dataArray[11][1]="12"; //La Romana
      $dataArray[11][2]="11"; //Population
      $dataArray[12][1]="13"; //No Save
      $dataArray[12][2]="12"; //Populatio
      $dataArray[13][1]="14"; //Maria  Trinidad Sanchez
      $dataArray[13][2]="13"; //Population
      $dataArray[14][1]="15"; //monte Cristi
      $dataArray[14][2]="14"; //Populatio
      $dataArray[15][1]="16"; //Pedernales
      $dataArray[15][2]="15"; //Population
      $dataArray[16][1]="17"; //Nose Save
      $dataArray[16][2]="16"; //Population
      $dataArray[17][1]="18"; //Puerto Plata
      $dataArray[17][2]="17"; //Population
      $dataArray[18][1]="19"; //Hermanas Mirabal
      $dataArray[18][2]="18"; //Population
      $dataArray[19][1]="20"; //Samana
      $dataArray[19][2]="19"; //Population
      $dataArray[20][1]="21"; //Sanchez Ramirez
      $dataArray[20][2]="20"; //Population
      $dataArray[21][1]="22"; //Nose Save
      $dataArray[21][2]="21"; //Population
      $dataArray[22][1]="23"; //San Juan
      $dataArray[22][2]="22"; //Populatio 
      $dataArray[23][1]="24"; //San Pedro De macori
      $dataArray[23][2]="23"; //Population 
      $dataArray[24][1]="25"; //Santiago
      $dataArray[24][2]="24"; //Populatio
      $dataArray[25][1]="26"; //Santiago Rodriguez
      $dataArray[25][2]="25"; //Population
      $dataArray[26][1]="27"; //Valverde
      $dataArray[26][2]="26"; //Population
      $dataArray[27][1]="28"; //El Seybo
      $dataArray[27][2]="27"; //Population
      $dataArray[28][1]="29"; //Hato Mayor
      $dataArray[28][2]="28"; //Population
      $dataArray[29][1]="30"; //La Vega
      $dataArray[29][2]="29"; //Population
      $dataArray[30][1]="31"; //Monseno Noel
      $dataArray[30][2]="30"; //Population
      $dataArray[31][1]="32"; //Monte Plata
      $dataArray[31][2]="31"; //Population
      $dataArray[32][1]="33"; //San Critobal
      $dataArray[32][2]="32"; //Population
      $dataArray[33][1]="34"; //Distrito Nacional
      $dataArray[33][2]="33"; //Population
      $dataArray[34][1]="35"; //Peravia
      $dataArray[34][2]="34"; //Population
      $dataArray[35][1]="36"; //San Jose de Ocoa
      $dataArray[35][2]="35"; //Population
      $dataArray[36][1]="37"; //Santo Domingo
      $dataArray[36][2]="36"; //Population 
	$strXML="";
	
	# Opening MAP element
	$strXML = "<map showLabels='1' includeNameInLabels='1' borderColor='FFFFFF' fillAlpha='80' showBevel='0' legendPosition='Bottom' >";
    
	# Setting Color ranges : 4 color ranges for population ranges
	$strXML .= "<colorRange>";
	$strXML .= "<color minValue='0' maxValue='1' displayValue='Population : Below 100 M' color='ff55ff' />";
	$strXML .= "<color minValue='1' maxValue='15' displayValue='Population :100 - 500 M' color='ff5544' />";
	$strXML .= "<color minValue='15' maxValue='36' displayValue='Population :500 - 1000 M' color='069F06' />";
	$strXML .= "<color minValue='36' maxValue='150' displayValue='Population : Above 1000 M' color='ff44ff' />";
	$strXML .= "</colorRange><data>";
	
	# Opening data element that will store map data
	# Using Data from array for each entity 
	for($i=0;$i< 37;$i++){
		$strXML .= "<entity id='" . $dataArray[$i][1] . "' value='" . $dataArray[$i][2] . "' />";
	}
    # closing  data element	
	$strXML .= "</data>";
	
	# closing map element
	$strXML  .= "</map>";
	
	echo  $strXML;
	}
	
	
}

?>